]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Add a special background to use for performance testing
authorOwen W. Taylor <otaylor@fishsoup.net>
Mon, 11 Aug 2014 12:35:52 +0000 (14:35 +0200)
committerOwen W. Taylor <otaylor@fishsoup.net>
Mon, 18 Aug 2014 14:54:42 +0000 (10:54 -0400)
Performance testing was producing inconsistent values at different
times in the day since the GNOME default background is animated and
sometimes has a single layer, and sometimes two blended layers.

So we have consistent numbers, install a simple animated background
with GNOME Shell that has 40-year long transition ending in 2030,a
and set an environment variable in gnome-shell-perf-tool so that the
background is override with that background. (The background depends
on files installed by gnome-backgrounds; we assume that the person
running performance tests is doing so within the scope of a full
GNOME install.)

https://bugzilla.gnome.org/show_bug.cgi?id=734610

.gitignore
data/Makefile.am
data/perf-background.xml.in [new file with mode: 0644]
js/ui/background.js
src/gnome-shell-perf-tool.in

index 987db1ee81c418fb6c17344278b9c8d316e93a57..e0147ae05f2945fa7460ea6f43b017f72519cdf7 100644 (file)
@@ -24,6 +24,7 @@ data/gnome-shell-wayland.desktop.in
 data/gnome-shell-extension-prefs.desktop
 data/gnome-shell-extension-prefs.desktop.in
 data/gschemas.compiled
+data/perf-background.xml
 data/org.gnome.shell.gschema.xml
 data/org.gnome.shell.gschema.valid
 data/org.gnome.shell.evolution.calendar.gschema.xml
index 1befb87c04ecf90361d85df43258e3e8e8cdd309..65f948aea74ac8832f85bcef0f4dc382aef3d1b5 100644 (file)
@@ -74,6 +74,13 @@ dist_theme_DATA =                            \
        theme/ws-switch-arrow-up.png            \
        theme/ws-switch-arrow-down.png
 
+backgrounddir = $(pkgdatadir)
+background_DATA = perf-background.xml
+
+perf-background.xml: perf-background.xml.in
+       $(AM_V_GEN) sed -e "s|@datadir[@]|$(datadir)|" \
+           $< > $@ || rm $@
+
 keysdir = @GNOME_KEYBINDINGS_KEYSDIR@
 keys_in_files = 50-gnome-shell-system.xml.in
 keys_DATA = $(keys_in_files:.xml.in=.xml)
@@ -106,6 +113,7 @@ EXTRA_DIST =                                                \
        $(menu_DATA)                                    \
        $(convert_DATA)                                 \
        $(keys_in_files)                                \
+       perf-background.xml.in                          \
        org.gnome.Shell.PortalHelper.desktop.in         \
        org.gnome.Shell.PortalHelper.service.in         \
        org.gnome.shell.gschema.xml.in.in
@@ -117,6 +125,7 @@ CLEANFILES +=                                               \
        $(desktop_DATA)                                 \
        $(keys_DATA)                                    \
        $(gsettings_SCHEMAS)                            \
+       perf-background.xml                             \
        gschemas.compiled                               \
        org.gnome.shell.gschema.valid                   \
        org.gnome.shell.gschema.xml.in
diff --git a/data/perf-background.xml.in b/data/perf-background.xml.in
new file mode 100644 (file)
index 0000000..752a552
--- /dev/null
@@ -0,0 +1,31 @@
+<!-- With an animated background, performance will differ depending on whether
+     one layer or two layers are being blended together. This messes up our
+     benchmarks. We could just benchmark a single image, but since blended
+     images are present for much of the day with the GNOME default background,
+     we want to make sure that also performs well; for that reason we ship
+     an "animated" background that animates super-slowly to use during
+     performance tests; it will be in the blended state until 2030. -->
+<background>
+  <starttime>
+    <year>1990</year>
+    <month>1</month>
+    <day>1</day>
+    <hour>0</hour>
+    <minute>00</minute>
+    <second>00</second>
+  </starttime>
+
+<!-- One transition that takes 40 years -->
+<transition type="overlay">
+<duration>1261440000.0</duration>
+<from>@datadir@/backgrounds/gnome/adwaita-morning.jpg</from>
+<to>@datadir@/backgrounds/gnome/adwaita-day.jpg</to>
+</transition>
+
+<!-- A single slide doesn't work, so another slide for 1 minute after 40 years -->
+<static>
+<duration>60</duration>
+<file>/usr/share/backgrounds/gnome/Sandstone.jpg</file>
+</static>
+
+</background>
index 021269989e62d12c37fee18130f6fb4abfadfd0e..3fe0b7a02a26640b53a8ca4fbef455f8fa598b80 100644 (file)
@@ -311,7 +311,8 @@ const Background = new Lang.Class({
         params = Params.parse(params, { monitorIndex: 0,
                                         layoutManager: Main.layoutManager,
                                         effects: Meta.BackgroundEffects.NONE,
-                                        settings: null });
+                                        settings: null,
+                                        overrideImage: null });
         this.actor = new Meta.BackgroundGroup();
         this.actor._delegate = this;
 
@@ -319,6 +320,7 @@ const Background = new Lang.Class({
                                                    Lang.bind(this, this._destroy));
 
         this._settings = params.settings;
+        this._overrideImage = params.overrideImage;
         this._monitorIndex = params.monitorIndex;
         this._layoutManager = params.layoutManager;
         this._effects = params.effects;
@@ -582,18 +584,23 @@ const Background = new Lang.Class({
 
         this._loadPattern();
 
-        this._style = this._settings.get_enum(BACKGROUND_STYLE_KEY);
-        if (this._style == GDesktopEnums.BackgroundStyle.NONE) {
-            this._setLoaded();
-            return;
-        }
-
-        let uri = this._settings.get_string(PICTURE_URI_KEY);
         let filename;
-        if (GLib.uri_parse_scheme(uri) != null)
-            filename = Gio.File.new_for_uri(uri).get_path();
-        else
-            filename = uri;
+        if (this._overrideImage != null) {
+            filename = this._overrideImage;
+            this._style = GDesktopEnums.BackgroundStyle.WALLPAPER; // Hardcode
+        } else {
+            this._style = this._settings.get_enum(BACKGROUND_STYLE_KEY);
+            if (this._style == GDesktopEnums.BackgroundStyle.NONE) {
+                this._setLoaded();
+                return;
+            }
+
+            let uri = this._settings.get_string(PICTURE_URI_KEY);
+            if (GLib.uri_parse_scheme(uri) != null)
+                filename = Gio.File.new_for_uri(uri).get_path();
+            else
+                filename = uri;
+        }
 
         if (!filename) {
             this._setLoaded();
@@ -728,6 +735,8 @@ const BackgroundManager = new Lang.Class({
                                         controlPosition: true,
                                         settingsSchema: BACKGROUND_SCHEMA });
 
+        // Allow override the background image setting for performance testing
+        this._overrideImage = GLib.getenv('SHELL_BACKGROUND_IMAGE');
         this._settings = new Gio.Settings({ schema_id: params.settingsSchema });
         this._container = params.container;
         this._layoutManager = params.layoutManager;
@@ -789,7 +798,8 @@ const BackgroundManager = new Lang.Class({
         let background = new Background({ monitorIndex: this._monitorIndex,
                                           layoutManager: this._layoutManager,
                                           effects: this._effects,
-                                          settings: this._settings });
+                                          settings: this._settings,
+                                          overrideImage: this._overrideImage });
         this._container.add_child(background.actor);
 
         let monitor = this._layoutManager.monitors[this._monitorIndex];
index 07374f6e8dbe8357a10de60836b19954fdf23374..3bb32dd50764176a3cf6a70b42529a6eba57049e 100644 (file)
@@ -82,6 +82,9 @@ def start_shell(perf_output=None):
     if perf_output is not None:
         env['SHELL_PERF_OUTPUT'] = perf_output
 
+    # A fixed background image
+    env['SHELL_BACKGROUND_IMAGE'] = '@pkgdatadir@/perf-background.xml'
+
     self_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
     args = []
     args.append(os.path.join(self_dir, 'gnome-shell'))